package org.zjvis.datascience.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.zjvis.datascience.common.dto.PluginInstanceDTO;
import org.zjvis.datascience.service.mapper.PluginInstanceMapper;

@Service
public class PluginInstanceService {
    @Autowired
    private PluginInstanceMapper pluginInstanceMapper;

    public Long save(PluginInstanceDTO instance) {
        pluginInstanceMapper.save(instance);
        return instance.getId();
    }

    public void update(PluginInstanceDTO instance) {
        pluginInstanceMapper.update(instance);
    }

    public void delete(Long id) {
        pluginInstanceMapper.delete(id);
    }

    public PluginInstanceDTO queryById(Long id) {
        return pluginInstanceMapper.queryById(id);
    }

    public Long queryLatestIdByPluginId(Long pluginId) {
        return pluginInstanceMapper.queryLatestIdByPluginId(pluginId);
    }
}
